package com.zx.idc.backend.gui.scheduler.slog.filterLog;

import com.zx.idc.ds.httplog.service.IHttpLogFilterLogService;
import com.zx.idc.ds.sys.entity.SysConfiguration;
import com.zx.idc.ds.sys.service.ISysConfigurationService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 过滤日志定时任务实现类
 */
public class FilterLogScheduledJob implements Job {
    @Autowired
    private IHttpLogFilterLogService logFilterLogService;

    @Autowired
    private ISysConfigurationService iSysConfigurationService;


    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        SysConfiguration sysConfiguration=iSysConfigurationService.selectOne(new SysConfiguration().setConfigKey("sysSettings_retain_icp_day"));
        Integer configValue=Integer.parseInt(sysConfiguration.getConfigValue());
        if(configValue>0){
            logFilterLogService.deleteByTime(configValue);
        }
    }
}
